y.label <- c("DDD", "DDR", "RRD", "RRR")
y <- c(4:1)
rrr.color <- "red"
rrd.color <- "purple"
ddr.color <- "orange"
ddd.color <- "blue"
color.vector <- c(ddd.color,ddr.color, rrd.color,rrr.color )
point.size <- 2.3

pdf("figure4b.pdf", height = 7, width = 4)

layout(rbind(1,2, 3), heights = c(2.7, 2.7,3.3))
par(mar = c(3,4,3,1))
plot(mean.vector, y, axes = F, xlim = c(.2,.8), ylim = c(.7,4.3), xlab = "", ylab = "", 
    main = "", pch = 19, col = color.vector, cex = 2.3)
points(mean.vector.hyp, y, pch = c(19,21,21,19),  cex = 2.3, col = color.vector)
arrows(mean.vector.hyp[3]+.01, 2, mean.vector[3]-.01, 2, length=.1)
arrows(mean.vector.hyp[2]-.01, 3, mean.vector[2]+.01, 3, length=.1)
axis(1, at = seq(.2,.8,.1), mgp=c(2,.7,0), cex.axis = 1.4)
axis(2, at = y, labels = y.label, las =1, mgp=c(2,.7,0), cex.axis = 1.4)
#segments(mean.vector-1.96*se.vector, y, mean.vector+1.96*se.vector,y, col = color.vector)
#mtext("Proportion of liberal decisions", 1, line =3, cex =1.8, font = 2)
mtext("All cases", 3, line = 1,  cex =1.5, font = 2)
#mtext("Panel type", 2, line = 4, cex =1.4, font = 1.2)

plot(mean.dem.circ.vector, y, axes = F, xlim = c(.2,.8),ylim = c(.7,4.3), xlab = "", ylab = "", 
    main = "", pch = 19, col = color.vector, cex = 2.3)
points(mean.dem.circ.vector.hyp, y, pch = c(19,21,21,19),  cex = 2.3, col = color.vector)
arrows(mean.dem.circ.vector.hyp[3]+.01, 2, mean.dem.circ.vector[3]-.01, 2, length=.1)
arrows(mean.dem.circ.vector.hyp[2]-.01, 3, mean.dem.circ.vector[2]+.01, 3, length=.1)
axis(1, at = seq(.2,.8,.1), mgp=c(2,.7,0), cex.axis = 1.4)
axis(2, at = y, labels = y.label, las =1, mgp=c(2,.7,0), cex.axis = 1.4)
#segments(mean.dem.circ.vector-1.96*se.dem.circ.vector, y, mean.dem.circ.vector+1.96*se.dem.circ.vector,y, col = color.vector)
mtext("Democratic circuits", 3, line = 1,  cex =1.5, font = 2)
#mtext("Panel type", 2, line = 4, cex =1.4, font = 1.2)

par(mar = c(7,4,3,1))
plot(mean.gop.circ.vector, y, axes = F, xlim = c(.2,.8),ylim = c(.7,4.3), xlab = "", ylab = "", 
    main = "", pch = 19, col = color.vector, cex = 2.3)
points(mean.gop.circ.vector.hyp, y, pch = c(19,21,21,19),  cex = 2.3, col = color.vector)
arrows(mean.gop.circ.vector.hyp[3]+.01, 2, mean.gop.circ.vector[3]-.01, 2, length=.1)
arrows(mean.gop.circ.vector.hyp[2]-.01, 3, mean.gop.circ.vector[2]+.01, 3, length=.1)
axis(1, at = seq(.2,.8,.1), mgp=c(2,.7,0), cex.axis = 1.4)
axis(2, at = y, labels = y.label, las =1, mgp=c(2,.7,0), cex.axis = 1.4)
#segments(mean.gop.circ.vector-1.96*se.gop.circ.vector, y, mean.gop.circ.vector+1.96*se.gop.circ.vector,y, col = color.vector)
mtext("Proportion of decisions\nthat are liberal", 1, line =5, cex =1.2, font = 3)
mtext("Republican circuits", 3, line = 1,  cex =1.5, font = 2)
#mtext("Panel type", 2, line = 4, cex =1.4, font = 1.2)

dev.off()